export default{
	addCart(context,payload){
		return new Promise((reslove,reject)=>{
			let oldProduct=context.state.cartList.find(function(item){
				return item.iid === payload.iid
			})	
			if(oldProduct){
				// oldProduct.count += 1
				context.commit('addCount',oldProduct)
				reslove("当前商品数量加一")
			}else{
				payload.count=1
				// context.state.cartList.push(payload)
				context.commit("addToCart",payload)
				reslove("添加了新的商品").then(res=>{
					console.log("res")
				})
			}
		})
	}
}